{extend name="base/common"}

{block name="style"}
<style>
    .mail-box .mail-ontact{
        width: 150px;
        min-width: 150px;
        overflow: hidden;
    }
    .mail-box .mail-subject{
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 124px !important;
        min-width: 124px;
    }
    .mail-subject-div{
        width: 100px;
        max-width: 100px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mail-box .mail-main{
        width: calc(100% - 460px);
        position: absolute;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mail-date{
        width: 160px;
        min-width: 160px;
        overflow: hidden;
    }
    @media only screen and (max-width: 550px){
        .mail-date{
            display: none;
        }
    }
    .list_banner {width: 80px}
    .list_type {width: 80px}
</style>
{/block}

{block name="page-header"}

{/block}

{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="mail-box-header">
            <form method="get" action="index.html" class="pull-right mail-search">
                <div class="input-group">
                    <input type="text" class="form-control input-sm" name="search" placeholder="搜索标题">
                    <div class="input-group-btn">
                        <button type="submit" class="btn btn-sm btn-primary">搜索</button>
                    </div>
                </div>
            </form>
            <h2>物业服务 ({$list->total()})</h2>
        </div>
        <div class="mail-box">
            <table class="table table-hover table-mail">
                <thead>
                <tr>
                    <th>服务类型</th>
                    <th>服务地点</th>
                    <th>联系人员</th>
                    <th>联系方式</th>
                    <th>备注</th>
                    <th>状态</th>
                    <th>编辑</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr class="read">
                    <td>{$vo.type_text}</td>
                    <td>{$vo.address}</td>
                    <td>{$vo.name}</td>
                    <td>{$vo.mobile}</td>
                    <td>{$vo.extra}</td>
                    <th>{$vo.status_text}</th>
                    <td>
                        {eq name="$vo.status" value="0"}
                        <button class="btn btn-sm btn-primary " onclick="changeStatus('{$vo.id}',0)">审核</button>
                        {else/}<button class="btn btn-sm btn-info " onclick="changeStatus('{$vo.id}',1)">删除</button>
                        {/eq}

                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
            <div class="btn-group pull-right">{$list->render()}</div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script src="/admin/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function(){
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $(".check-all").on("ifChanged",function(){
            $("tbody").find(".ids").iCheck("toggle");
        });
    });
    /*修改服务状态值*/
    function changeStatus(id,uid){
        $.ajax({
            data:{id:id,del:uid},
            type:"POST",
            url:"{:Url('Property/changeStatus')}",
            success:function (data){
                if(data.code==1){
                    updateAlert(data.msg+ ' 页面即将自动跳转~','success');
                    setTimeout(function(){
                        location.href=data.url;
                    },2000);
                }else{
                    updateAlert(data.msg,'info');
                }
            }
        })

    }
</script>
{/block}